<?php echo $this->fetch('header.html'); ?>

<ul class="nav nav-tabs">
<li><a href="<?php echo $this->_var['appadmin']; ?>?m=sites"><?php echo $this->_var['lang']['sites_admin']; ?></a></li> 
</ul>

<form method="post" action="<?php echo $this->_var['appadmin']; ?>?m=sites&a=save">
<input type="hidden" name="siteid" value="<?php echo $this->_var['data']['siteid']; ?>" />
<table width="100%" border="0" class="table table-bordered">
  <tr>
    <td width="17%" align="right"><?php echo $this->_var['lang']['sitename']; ?>：</td>
    <td width="83%"><input name="sitename" type="text" id="sitename" value="<?php echo $this->_var['data']['sitename']; ?>" /></td>
  </tr>
  <tr>
  	<td>所在地区</td>
    <td>
    <?php $this->assign("tc",M("options")->children(0,"sitearea",1)); ?>
    	<select name="cityid">
    		<option value="0">请选择</option>
            <?php $_from = $this->_var['tc']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'c');if (count($_from)):
    foreach ($_from AS $this->_var['c']):
?>
            <option value="<?php echo $this->_var['c']['id']; ?>" <?php if ($this->_var['c']['id'] == $this->_var['data']['cityid']): ?> selected<?php endif; ?>><?php echo $this->_var['c']['title']; ?></option>
            <?php if ($this->_var['c']['child']): ?>
            <?php $_from = $this->_var['c']['child']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'cc');if (count($_from)):
    foreach ($_from AS $this->_var['cc']):
?>
            <option value="<?php echo $this->_var['cc']['id']; ?>" <?php if ($this->_var['cc']['id'] == $this->_var['data']['cityid']): ?> selected<?php endif; ?>>|--<?php echo $this->_var['cc']['title']; ?></option>
            <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
            <?php endif; ?>
            <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
    	</select>
    </td>
  </tr>
  <tr>
    <td align="right"><?php echo $this->_var['lang']['domain']; ?>：</td>
    <td><input name="domain" type="text" id="domain" value="<?php echo $this->_var['data']['domain']; ?>" /></td>
  </tr>
 
  <tr>
  	<td>logo：</td>
    <td><div id="up1" url="/index.php?m=upload&a=uploadtao&dir=site&id=<?php echo $this->_var['data']['id']; ?>">
    	<div class="btn-upload">
          <input type="file" name="upimg" id="ud"  class="btn-upload-file" onChange="uploadimg('up1')">
         </div>
 
          <input type="hidden" name="logo" class="imgurl" value="<?php echo $this->_var['data']['logo']; ?>">
          <span class="imgShow">
          <?php if ($this->_var['data']['logo']): ?>
          <img src="<?php echo images_site($this->_var['data']['logo']); ?>.100x100.jpg">
          <?php endif; ?>
          </span>
      </div></td>
  </tr>
  <tr>
    <td align="right"><?php echo $this->_var['lang']['title']; ?>：</td>
    <td><input name="title" type="text" id="title" value="<?php echo $this->_var['data']['title']; ?>" class="w600" /></td>
  </tr>
  <tr>
    <td align="right"><?php echo $this->_var['lang']['keywords']; ?>：</td>
    <td><input name="keywords" type="text" id="keywords" value="<?php echo $this->_var['data']['keywords']; ?>" class="w600" /></td>
  </tr>
  <tr>
    <td align="right"><?php echo $this->_var['lang']['description']; ?>：</td>
    <td><textarea name="description" id="description" cols="45" rows="5"><?php echo $this->_var['data']['description']; ?></textarea></td>
  </tr>
  
  <tr>
    <td align="right"><?php echo $this->_var['lang']['is_open']; ?>：</td>
    <td><input type="radio" name="is_open" id="radio" value="1" <?php if ($this->_var['data']['is_open'] == 1): ?> checked="checked"<?php endif; ?> />
      <?php echo $this->_var['lang']['open']; ?>
        <input type="radio" name="is_open" id="radio2" value="2" <?php if ($this->_var['data']['is_open'] == 2): ?> checked="checked"<?php endif; ?> />
      <?php echo $this->_var['lang']['close']; ?></td>
  </tr>
  
  <tr>
    <td align="right"><?php echo $this->_var['lang']['icp']; ?>：</td>
    <td><input name="icp" type="text" id="icp" value="<?php echo $this->_var['data']['icp']; ?>" /></td>
  </tr>
  <tr>
    <td align="right"><?php echo $this->_var['lang']['index_template']; ?>：</td>
    <td><input name="index_template" type="text" id="template" value="<?php echo $this->_var['data']['index_template']; ?>" size="40" /></td>
  </tr>
  <tr>
    <td align="right"><?php echo $this->_var['lang']['statjs']; ?>：</td>
    <td><textarea name="statjs" cols="45" rows="5" id="statjs"><?php echo $this->_var['data']['statjs']; ?></textarea></td>
  </tr>
  <tr>
  	<td>Gps</td>
    <td>
    地图搜索：<input type="text" name="word" id="word" /> <br>
    <div id="map_canvas" style="width:600px; height:300px;"></div>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=<?php echo BDMAPKEY; ?>"></script>
    <script language="javascript">
	function NoSubmit(ev)
	{
		if( ev.keyCode == 13 )
		{
			return false;
		}
		return true;
	}
	$("#word").bind("keyup",function(){
			localsearch($(this).val());
		});
   var map = new BMap.Map("map_canvas");
   map.enableScrollWheelZoom();
   var point = new BMap.Point(<?php if ($this->_var['data']['lat'] > 0): ?><?php echo $this->_var['data']['lng']; ?>,<?php echo $this->_var['data']['lat']; ?><?php else: ?>118.165810,24.485228<?php endif; ?>);
   map.centerAndZoom(point, 12);
   var marker = new BMap.Marker(point);  // 创建标注
	map.addOverlay(marker);              // 将标注添加到地图中
	marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
   map.addEventListener("click", function(e){
	   map.removeOverlay(marker);
	   point = new BMap.Point(e.point.lng,e.point.lat);
	   marker = new BMap.Marker(point);  // 创建标注
	   
		map.addOverlay(marker);  
	   $("#lat").val(e.point.lat);
	   $("#lng").val(e.point.lng);
   });
   
   function localsearch(word){
	   var local = new BMap.LocalSearch(map, {
		  renderOptions:{map: map}
		});
		local.search(word);
   }
    </script></td>
  </tr>
   <tr>
          <td>纬度：</td>
          <td><input type='text' name='lat' id='lat' value='<?php echo $this->_var['data']['lat']; ?>' ></td>
        </tr>
        <tr>
          <td>精度：</td>
          <td><input type='text' name='lng' id='lng' value='<?php echo $this->_var['data']['lng']; ?>' ></td>
        </tr>
  <tr>
    <td align="right">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="right">&nbsp;</td>
    <td><input type="submit" name="button" id="button" value="提交" class="btn" /></td>
  </tr>
</table>

</form>
<script language="javascript" src="/plugin/jquery/ajaxfileupload.js"></script>
<script language="javascript" src="/static/js/upload.js"></script>
<?php echo $this->fetch('footer.html'); ?>